#include <iostream>
#include <string>
#include <list>
using namespace std;


void show_list(list<string> L)
{ list<string>::iterator p;
  for(p=L.begin(); p!=L.end(); p++)
    cout << *p << " ";
  cout << endl;
}    
  
string a[5] = {"Gabrovo","Pleven","Burgas","Sofia","Plovdiv"};

list<string> L(a,a+5);

bool usl(string s)
{ return s[0]=='P'; }

int main()
{ 
  show_list(L);
  
  L.sort();
  show_list(L);
  
  L.remove_if(usl);
  
  show_list(L);
    
  return 0;
}    
